﻿using System;
using System.Collections.Generic;

using System.Text;

namespace KPIS.GERP.ESS.BLL
{
    class Common
    {
        public bool IsNumeric(string strText)
        {
            bool bNumeric = false;	//test remark

            try
            {
                double.Parse(strText);
                bNumeric = true;
            }
            catch
            {
            }

            return bNumeric;
        }

        public Nullable<int> ConvertNullInt(Object o)
        {
            Nullable<int> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<int>)Convert.ToInt32(o)));
            return result;
        }

        public Nullable<double> ConvertNullDouble(Object o)
        {
            Nullable<double> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<double>)Convert.ToDouble(o)));
            return result;
        }

        public Nullable<DateTime> ConvertNullDateTime(Object o)
        {
            Nullable<DateTime> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<DateTime>)Convert.ToDateTime(o)));
            return result;
        }
    }
}
